﻿using Single.Core.Service;
using Single.Sugar.Db;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Single.Sugar.Service
{
    public abstract class SugarService : ServiceDependency
    {
        // DB 多租户事务、GetConnection、IsAnyConnection 等功能
        protected ITenant tenant;

        // 其他数据对象样本
        protected ISqlSugarClient db => DbContext.DbScope.GetConnectionScope("SingleDefault");
        protected ISqlSugarClient dbOa => DbContext.DbScope.GetConnectionScope("Oa");

        protected SugarService()
        {
            tenant = DbContext.DbScope;
        }
    }
}